deprecations: Move files into deprecated/ dir
authorBenjamin Otte <otte@redhat.com>
Sun, 25 Nov 2012 03:16:43 +0000 (04:16 +0100)
committerBenjamin Otte <otte@redhat.com>
Sun, 25 Nov 2012 03:16:43 +0000 (04:16 +0100)
21 files changed:
gtk/Makefile.am
gtk/deprecated/gtkgradient.c [new file with mode: 0644]
gtk/deprecated/gtkgradient.h [new file with mode: 0644]
gtk/deprecated/gtkgradientprivate.h [new file with mode: 0644]
gtk/deprecated/gtksymboliccolor.c [new file with mode: 0644]
gtk/deprecated/gtksymboliccolor.h [new file with mode: 0644]
gtk/deprecated/gtksymboliccolorprivate.h [new file with mode: 0644]
gtk/gtk.h
gtk/gtkcsscolorvalue.c
gtk/gtkcsscustomproperty.c
gtk/gtkcssimagegradient.c
gtk/gtkcssimagegradientprivate.h
gtk/gtkcssstylefuncs.c
gtk/gtkgradient.c [deleted file]
gtk/gtkgradient.h [deleted file]
gtk/gtkgradientprivate.h [deleted file]
gtk/gtkstylecontext.c
gtk/gtkstyleproperties.c
gtk/gtksymboliccolor.c [deleted file]
gtk/gtksymboliccolor.h [deleted file]
gtk/gtksymboliccolorprivate.h [deleted file]

index aa8145f745132a9a0d147caefb7f8f6ea33b7e41..f0659f1285107f096c181fbfc6e5151344e6e9ce 100644 (file)
@@ -148,6 +148,7 @@ deprecated_h_sources =                      \
        deprecated/gtkcolorsel.h        \
        deprecated/gtkcolorseldialog.h  \
        deprecated/gtkfontsel.h         \
+       deprecated/gtkgradient.h        \
        deprecated/gtkhandlebox.h       \
        deprecated/gtkhbbox.h           \
        deprecated/gtkhbox.h            \
@@ -156,8 +157,9 @@ deprecated_h_sources =                      \
        deprecated/gtkhscrollbar.h      \
        deprecated/gtkhseparator.h      \
        deprecated/gtkhsv.h             \
-       deprecated/gtkstyle.h           \
        deprecated/gtkrc.h              \
+       deprecated/gtkstyle.h           \
+       deprecated/gtksymboliccolor.h   \
        deprecated/gtktable.h           \
        deprecated/gtktearoffmenuitem.h \
        deprecated/gtkvbbox.h           \
@@ -167,6 +169,10 @@ deprecated_h_sources =                     \
        deprecated/gtkvseparator.h      \
        deprecated/gtkvpaned.h
 
+deprecated_private_h_sources =                 \
+       deprecated/gtkgradientprivate.h         \
+       deprecated/gtksymboliccolorprivate.h
+
 gtk_public_h_sources =                 \
        gtk.h                   \
        gtkx.h                  \
@@ -249,7 +255,6 @@ gtk_public_h_sources =              \
        gtkfontchooserdialog.h  \
        gtkfontchooserwidget.h  \
        gtkframe.h              \
-       gtkgradient.h           \
        gtkgrid.h               \
        gtkiconfactory.h        \
        gtkicontheme.h          \
@@ -330,7 +335,6 @@ gtk_public_h_sources =              \
        gtkstyleproperties.h    \
        gtkstyleprovider.h      \
        gtkswitch.h             \
-       gtksymboliccolor.h      \
        gtktestutils.h          \
        gtktextattributes.h     \
        gtktextbuffer.h         \
@@ -478,7 +482,6 @@ gtk_private_h_sources =             \
        gtkfilesystemmodel.h    \
        gtkfontchooserprivate.h \
        gtkfontchooserutils.h   \
-       gtkgradientprivate.h    \
        gtkhslaprivate.h        \
        gtkiconcache.h          \
        gtkiconhelperprivate.h  \
@@ -527,7 +530,6 @@ gtk_private_h_sources =             \
        gtkstylepropertiesprivate.h \
        gtkstylepropertyprivate.h \
        gtkstyleproviderprivate.h \
-       gtksymboliccolorprivate.h \
        gtktextbtree.h          \
        gtktextbufferserialize.h \
        gtktextchildprivate.h   \
@@ -556,6 +558,7 @@ deprecated_c_sources =                      \
        deprecated/gtkcolorsel.c        \
        deprecated/gtkcolorseldialog.c  \
        deprecated/gtkfontsel.c         \
+       deprecated/gtkgradient.c        \
        deprecated/gtkhandlebox.c       \
        deprecated/gtkhbbox.c           \
        deprecated/gtkhbox.c            \
@@ -566,6 +569,7 @@ deprecated_c_sources =                      \
        deprecated/gtkhsv.c             \
        deprecated/gtkrc.c              \
        deprecated/gtkstyle.c           \
+       deprecated/gtksymboliccolor.c   \
        deprecated/gtktable.c           \
        deprecated/gtktearoffmenuitem.c \
        deprecated/gtkvbbox.c           \
@@ -721,7 +725,6 @@ gtk_base_c_sources =                \
        gtkfontchooserutils.c   \
        gtkfontchooserwidget.c  \
        gtkframe.c              \
-       gtkgradient.c           \
        gtkgrid.c               \
        gtkhsla.c               \
        gtkiconcache.c          \
@@ -824,7 +827,6 @@ gtk_base_c_sources =                \
        gtkstyleprovider.c      \
        gtkstyleproviderprivate.c       \
        gtkswitch.c             \
-       gtksymboliccolor.c      \
        gtktestutils.c          \
        gtktextattributes.c     \
        gtktextbtree.c          \
@@ -973,6 +975,7 @@ gtk_private_h_sources += $(gtk_use_quartz_private_h_sources)
 endif
 
 gtk_all_private_h_sources = \
+       $(deprecated_private_h_sources) \
        $(gtk_private_h_sources) \
        $(gtk_use_x11_private_h_sources) \
        $(gtk_use_win32_private_h_sources) \
diff --git a/gtk/deprecated/gtkgradient.c b/gtk/deprecated/gtkgradient.c
new file mode 100644 (file)
index 0000000..78cf7a3
--- /dev/null
@@ -0,0 +1,551 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
+#include "gtkgradientprivate.h"
+
+#include "gtkcsscolorvalueprivate.h"
+#include "gtkcssrgbavalueprivate.h"
+#include "gtkstylecontextprivate.h"
+#include "gtkstyleproperties.h"
+#include "gtksymboliccolorprivate.h"
+
+/**
+ * SECTION:gtkgradient
+ * @Short_description: Gradients
+ * @Title: GtkGradient
+ *
+ * GtkGradient is a boxed type that represents a gradient.
+ * It is the result of parsing a
+ * <link linkend="gtkcssprovider-gradients">gradient expression</link>.
+ * To obtain the gradient represented by a GtkGradient, it has to
+ * be resolved with gtk_gradient_resolve(), which replaces all
+ * symbolic color references by the colors they refer to (in a given
+ * context) and constructs a #cairo_pattern_t value.
+ *
+ * It is not normally necessary to deal directly with #GtkGradients,
+ * since they are mostly used behind the scenes by #GtkStyleContext and
+ * #GtkCssProvider.
+ *
+ * #GtkGradient is deprecated. It was used internally by GTK's CSS engine
+ * to represent gradients. As its handling is not conforming to modern
+ * web standards, it is not used anymore. If you want to use gradients in
+ * your own code, please use Cairo directly.
+ */
+
+G_DEFINE_BOXED_TYPE (GtkGradient, gtk_gradient,
+                     gtk_gradient_ref, gtk_gradient_unref)
+
+typedef struct ColorStop ColorStop;
+
+struct ColorStop
+{
+  gdouble offset;
+  GtkSymbolicColor *color;
+};
+
+struct _GtkGradient
+{
+  gdouble x0;
+  gdouble y0;
+  gdouble x1;
+  gdouble y1;
+  gdouble radius0;
+  gdouble radius1;
+
+  GArray *stops;
+
+  guint ref_count;
+};
+
+/**
+ * gtk_gradient_new_linear:
+ * @x0: X coordinate of the starting point
+ * @y0: Y coordinate of the starting point
+ * @x1: X coordinate of the end point
+ * @y1: Y coordinate of the end point
+ *
+ * Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient
+ * a number of stop colors must be added through gtk_gradient_add_color_stop().
+ *
+ * Returns: A newly created #GtkGradient
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkGradient is deprecated.
+ **/
+GtkGradient *
+gtk_gradient_new_linear (gdouble x0,
+                         gdouble y0,
+                         gdouble x1,
+                         gdouble y1)
+{
+  GtkGradient *gradient;
+
+  gradient = g_slice_new (GtkGradient);
+  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
+
+  gradient->x0 = x0;
+  gradient->y0 = y0;
+  gradient->x1 = x1;
+  gradient->y1 = y1;
+  gradient->radius0 = 0;
+  gradient->radius1 = 0;
+
+  gradient->ref_count = 1;
+
+  return gradient;
+}
+
+/**
+ * gtk_gradient_new_radial:
+ * @x0: X coordinate of the start circle
+ * @y0: Y coordinate of the start circle
+ * @radius0: radius of the start circle
+ * @x1: X coordinate of the end circle
+ * @y1: Y coordinate of the end circle
+ * @radius1: radius of the end circle
+ *
+ * Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and
+ * (x1, y1, radius1). Before using the gradient a number of stop colors must be added
+ * through gtk_gradient_add_color_stop().
+ *
+ * Returns: A newly created #GtkGradient
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkGradient is deprecated.
+ **/
+GtkGradient *
+gtk_gradient_new_radial (gdouble x0,
+                        gdouble y0,
+                        gdouble radius0,
+                        gdouble x1,
+                        gdouble y1,
+                        gdouble radius1)
+{
+  GtkGradient *gradient;
+
+  gradient = g_slice_new (GtkGradient);
+  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
+
+  gradient->x0 = x0;
+  gradient->y0 = y0;
+  gradient->x1 = x1;
+  gradient->y1 = y1;
+  gradient->radius0 = radius0;
+  gradient->radius1 = radius1;
+
+  gradient->ref_count = 1;
+
+  return gradient;
+}
+
+/**
+ * gtk_gradient_add_color_stop:
+ * @gradient: a #GtkGradient
+ * @offset: offset for the color stop
+ * @color: color to use
+ *
+ * Adds a stop color to @gradient.
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkGradient is deprecated.
+ **/
+void
+gtk_gradient_add_color_stop (GtkGradient      *gradient,
+                             gdouble           offset,
+                             GtkSymbolicColor *color)
+{
+  ColorStop stop;
+
+  g_return_if_fail (gradient != NULL);
+
+  stop.offset = offset;
+  stop.color = gtk_symbolic_color_ref (color);
+
+  g_array_append_val (gradient->stops, stop);
+}
+
+/**
+ * gtk_gradient_ref:
+ * @gradient: a #GtkGradient
+ *
+ * Increases the reference count of @gradient.
+ *
+ * Returns: The same @gradient
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkGradient is deprecated.
+ **/
+GtkGradient *
+gtk_gradient_ref (GtkGradient *gradient)
+{
+  g_return_val_if_fail (gradient != NULL, NULL);
+
+  gradient->ref_count++;
+
+  return gradient;
+}
+
+/**
+ * gtk_gradient_unref:
+ * @gradient: a #GtkGradient
+ *
+ * Decreases the reference count of @gradient, freeing its memory
+ * if the reference count reaches 0.
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkGradient is deprecated.
+ **/
+void
+gtk_gradient_unref (GtkGradient *gradient)
+{
+  g_return_if_fail (gradient != NULL);
+
+  gradient->ref_count--;
+
+  if (gradient->ref_count == 0)
+    {
+      guint i;
+
+      for (i = 0; i < gradient->stops->len; i++)
+        {
+          ColorStop *stop;
+
+          stop = &g_array_index (gradient->stops, ColorStop, i);
+          gtk_symbolic_color_unref (stop->color);
+        }
+
+      g_array_free (gradient->stops, TRUE);
+      g_slice_free (GtkGradient, gradient);
+    }
+}
+
+/**
+ * gtk_gradient_resolve:
+ * @gradient: a #GtkGradient
+ * @props: #GtkStyleProperties to use when resolving named colors
+ * @resolved_gradient: (out): return location for the resolved pattern
+ *
+ * If @gradient is resolvable, @resolved_gradient will be filled in
+ * with the resolved gradient as a cairo_pattern_t, and %TRUE will
+ * be returned. Generally, if @gradient can't be resolved, it is
+ * due to it being defined on top of a named color that doesn't
+ * exist in @props.
+ *
+ * Returns: %TRUE if the gradient has been resolved
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkGradient is deprecated.
+ **/
+gboolean
+gtk_gradient_resolve (GtkGradient         *gradient,
+                      GtkStyleProperties  *props,
+                      cairo_pattern_t    **resolved_gradient)
+{
+  cairo_pattern_t *pattern;
+  guint i;
+
+  g_return_val_if_fail (gradient != NULL, FALSE);
+  g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
+  g_return_val_if_fail (resolved_gradient != NULL, FALSE);
+
+  if (gradient->radius0 == 0 && gradient->radius1 == 0)
+    pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
+                                           gradient->x1, gradient->y1);
+  else
+    pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0,
+                                           gradient->radius0,
+                                           gradient->x1, gradient->y1,
+                                           gradient->radius1);
+
+  for (i = 0; i < gradient->stops->len; i++)
+    {
+      ColorStop *stop;
+      GdkRGBA color;
+
+      stop = &g_array_index (gradient->stops, ColorStop, i);
+
+      if (!gtk_symbolic_color_resolve (stop->color, props, &color))
+        {
+          cairo_pattern_destroy (pattern);
+          return FALSE;
+        }
+
+      cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
+                                         color.red, color.green,
+                                         color.blue, color.alpha);
+    }
+
+  *resolved_gradient = pattern;
+  return TRUE;
+}
+
+cairo_pattern_t *
+_gtk_gradient_resolve_full (GtkGradient             *gradient,
+                            GtkStyleProviderPrivate *provider,
+                            GtkCssComputedValues    *values,
+                            GtkCssComputedValues    *parent_values,
+                            GtkCssDependencies      *dependencies)
+{
+  cairo_pattern_t *pattern;
+  guint i;
+
+  g_return_val_if_fail (gradient != NULL, NULL);
+  g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
+  g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
+  g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
+  g_return_val_if_fail (*dependencies == 0, NULL);
+
+  if (gradient->radius0 == 0 && gradient->radius1 == 0)
+    pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
+                                           gradient->x1, gradient->y1);
+  else
+    pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0,
+                                           gradient->radius0,
+                                           gradient->x1, gradient->y1,
+                                           gradient->radius1);
+
+  for (i = 0; i < gradient->stops->len; i++)
+    {
+      ColorStop *stop;
+      GtkCssValue *val;
+      GdkRGBA rgba;
+      GtkCssDependencies stop_deps;
+
+      stop = &g_array_index (gradient->stops, ColorStop, i);
+
+      /* if color resolving fails, assume transparency */
+      val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (stop->color),
+                                          provider,
+                                          _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
+                                          GTK_CSS_DEPENDS_ON_COLOR,
+                                          &stop_deps);
+      if (val)
+        {
+          rgba = *_gtk_css_rgba_value_get_rgba (val);
+          *dependencies = _gtk_css_dependencies_union (*dependencies, stop_deps);
+          _gtk_css_value_unref (val);
+        }
+      else
+        {
+          rgba.red = rgba.green = rgba.blue = rgba.alpha = 0.0;
+        }
+
+      cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
+                                         rgba.red, rgba.green,
+                                         rgba.blue, rgba.alpha);
+    }
+
+  return pattern;
+}
+
+static void
+append_number (GString    *str,
+               double      d,
+               const char *zero,
+               const char *half,
+               const char *one)
+{
+  if (zero && d == 0.0)
+    g_string_append (str, zero);
+  else if (half && d == 0.5)
+    g_string_append (str, half);
+  else if (one && d == 1.0)
+    g_string_append (str, one);
+  else
+    {
+      char buf[G_ASCII_DTOSTR_BUF_SIZE];
+
+      g_ascii_dtostr (buf, sizeof (buf), d);
+      g_string_append (str, buf);
+    }
+}
+
+/**
+ * gtk_gradient_to_string:
+ * @gradient: the gradient to print
+ *
+ * Creates a string representation for @gradient that is suitable
+ * for using in GTK CSS files.
+ *
+ * Returns: A string representation for @gradient
+ *
+ * Deprecated: 3.8: #GtkGradient is deprecated.
+ **/
+char *
+gtk_gradient_to_string (GtkGradient *gradient)
+{
+  GString *str;
+  guint i;
+
+  g_return_val_if_fail (gradient != NULL, NULL);
+
+  str = g_string_new ("-gtk-gradient (");
+
+  if (gradient->radius0 == 0 && gradient->radius1 == 0)
+    {
+      g_string_append (str, "linear, ");
+      append_number (str, gradient->x0, "left", "center", "right");
+      g_string_append_c (str, ' ');
+      append_number (str, gradient->y0, "top", "center", "bottom");
+      g_string_append (str, ", ");
+      append_number (str, gradient->x1, "left", "center", "right");
+      g_string_append_c (str, ' ');
+      append_number (str, gradient->y1, "top", "center", "bottom");
+    }
+  else
+    {
+      g_string_append (str, "radial, ");
+      append_number (str, gradient->x0, "left", "center", "right");
+      g_string_append_c (str, ' ');
+      append_number (str, gradient->y0, "top", "center", "bottom");
+      g_string_append (str, ", ");
+      append_number (str, gradient->radius0, NULL, NULL, NULL);
+      g_string_append (str, ", ");
+      append_number (str, gradient->x1, "left", "center", "right");
+      g_string_append_c (str, ' ');
+      append_number (str, gradient->y1, "top", "center", "bottom");
+      g_string_append (str, ", ");
+      append_number (str, gradient->radius1, NULL, NULL, NULL);
+    }
+  
+  for (i = 0; i < gradient->stops->len; i++)
+    {
+      ColorStop *stop;
+      char *s;
+
+      stop = &g_array_index (gradient->stops, ColorStop, i);
+
+      g_string_append (str, ", ");
+
+      if (stop->offset == 0.0)
+        g_string_append (str, "from (");
+      else if (stop->offset == 1.0)
+        g_string_append (str, "to (");
+      else
+        {
+          g_string_append (str, "color-stop (");
+          append_number (str, stop->offset, NULL, NULL, NULL);
+          g_string_append (str, ", ");
+        }
+
+      s = gtk_symbolic_color_to_string (stop->color);
+      g_string_append (str, s);
+      g_free (s);
+
+      g_string_append (str, ")");
+    }
+
+  g_string_append (str, ")");
+
+  return g_string_free (str, FALSE);
+}
+
+static GtkGradient *
+gtk_gradient_fade (GtkGradient *gradient,
+                   double       opacity)
+{
+  GtkGradient *faded;
+  guint i;
+
+  faded = g_slice_new (GtkGradient);
+  faded->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
+
+  faded->x0 = gradient->x0;
+  faded->y0 = gradient->y0;
+  faded->x1 = gradient->x1;
+  faded->y1 = gradient->y1;
+  faded->radius0 = gradient->radius0;
+  faded->radius1 = gradient->radius1;
+
+  faded->ref_count = 1;
+
+  for (i = 0; i < gradient->stops->len; i++)
+    {
+      GtkSymbolicColor *color;
+      ColorStop *stop;
+
+      stop = &g_array_index (gradient->stops, ColorStop, i);
+      color = gtk_symbolic_color_new_alpha (stop->color, opacity);
+      gtk_gradient_add_color_stop (faded, stop->offset, color);
+      gtk_symbolic_color_unref (color);
+    }
+
+  return faded;
+}
+
+GtkGradient *
+_gtk_gradient_transition (GtkGradient *start,
+                          GtkGradient *end,
+                          guint        property_id,
+                          double       progress)
+{
+  GtkGradient *gradient;
+  guint i;
+
+  g_return_val_if_fail (start != NULL, NULL);
+
+  if (end == NULL)
+    return gtk_gradient_fade (start, 1.0 - CLAMP (progress, 0.0, 1.0));
+
+  if (start->stops->len != end->stops->len)
+    return NULL;
+
+  /* check both are radial/linear */
+  if ((start->radius0 == 0 && start->radius1 == 0) != (end->radius0 == 0 && end->radius1 == 0))
+    return NULL;
+
+  gradient = g_slice_new (GtkGradient);
+  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
+
+  gradient->x0 = (1 - progress) * start->x0 + progress * end->x0;
+  gradient->y0 = (1 - progress) * start->y0 + progress * end->y0;
+  gradient->x1 = (1 - progress) * start->x1 + progress * end->x1;
+  gradient->y1 = (1 - progress) * start->y1 + progress * end->y1;
+  gradient->radius0 = (1 - progress) * start->radius0 + progress * end->radius0;
+  gradient->radius1 = (1 - progress) * start->radius1 + progress * end->radius1;
+
+  gradient->ref_count = 1;
+
+  for (i = 0; i < start->stops->len; i++)
+    {
+      ColorStop *start_stop, *end_stop;
+      GtkSymbolicColor *color;
+      double offset;
+
+      start_stop = &g_array_index (start->stops, ColorStop, i);
+      end_stop = &g_array_index (end->stops, ColorStop, i);
+
+      offset = (1 - progress) * start_stop->offset + progress * end_stop->offset;
+      color = gtk_symbolic_color_new_mix (start_stop->color,
+                                          end_stop->color,
+                                          progress);
+      gtk_gradient_add_color_stop (gradient, offset, color);
+      gtk_symbolic_color_unref (color);
+    }
+
+  return gradient;
+}
diff --git a/gtk/deprecated/gtkgradient.h b/gtk/deprecated/gtkgradient.h
new file mode 100644 (file)
index 0000000..767461f
--- /dev/null
@@ -0,0 +1,74 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_GRADIENT_H__
+#define __GTK_GRADIENT_H__
+
+#include <gdk/gdk.h>
+#include <gtk/gtkstylecontext.h>
+#include <gtk/gtkstyleproperties.h>
+#include <gtk/deprecated/gtksymboliccolor.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_GRADIENT (gtk_gradient_get_type ())
+
+GType         gtk_gradient_get_type       (void) G_GNUC_CONST;
+
+GDK_DEPRECATED_IN_3_8
+GtkGradient * gtk_gradient_new_linear     (gdouble              x0,
+                                           gdouble              y0,
+                                           gdouble              x1,
+                                           gdouble              y1);
+GDK_DEPRECATED_IN_3_8
+GtkGradient * gtk_gradient_new_radial     (gdouble              x0,
+                                           gdouble              y0,
+                                           gdouble              radius0,
+                                           gdouble              x1,
+                                           gdouble              y1,
+                                           gdouble              radius1);
+
+GDK_DEPRECATED_IN_3_8
+void          gtk_gradient_add_color_stop (GtkGradient         *gradient,
+                                           gdouble              offset,
+                                           GtkSymbolicColor    *color);
+
+GDK_DEPRECATED_IN_3_8
+GtkGradient * gtk_gradient_ref            (GtkGradient         *gradient);
+GDK_DEPRECATED_IN_3_8
+void          gtk_gradient_unref          (GtkGradient         *gradient);
+
+GDK_DEPRECATED_IN_3_8
+gboolean      gtk_gradient_resolve        (GtkGradient         *gradient,
+                                           GtkStyleProperties  *props,
+                                           cairo_pattern_t    **resolved_gradient);
+GDK_DEPRECATED_IN_3_8
+cairo_pattern_t *
+              gtk_gradient_resolve_for_context
+                                          (GtkGradient         *gradient,
+                                           GtkStyleContext     *context);
+
+GDK_DEPRECATED_IN_3_8
+char *        gtk_gradient_to_string      (GtkGradient         *gradient);
+
+G_END_DECLS
+
+#endif /* __GTK_GRADIENT_H__ */
diff --git a/gtk/deprecated/gtkgradientprivate.h b/gtk/deprecated/gtkgradientprivate.h
new file mode 100644 (file)
index 0000000..9cd37f2
--- /dev/null
@@ -0,0 +1,39 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2012 Benjamin Otte <otte@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTK_GRADIENT_PRIVATE_H__
+#define __GTK_GRADIENT_PRIVATE_H__
+
+#include "gtkgradient.h"
+#include "gtkcsstypesprivate.h"
+
+G_BEGIN_DECLS
+
+cairo_pattern_t *       _gtk_gradient_resolve_full            (GtkGradient             *gradient,
+                                                               GtkStyleProviderPrivate *provider,
+                                                               GtkCssComputedValues    *values,
+                                                               GtkCssComputedValues    *parent_values,
+                                                               GtkCssDependencies      *dependencies);
+
+GtkGradient *           _gtk_gradient_transition              (GtkGradient             *start,
+                                                               GtkGradient             *end,
+                                                               guint                    property_id,
+                                                               double                   progress);
+
+G_END_DECLS
+
+#endif /* __GTK_STYLE_PROPERTIES_PRIVATE_H__ */
diff --git a/gtk/deprecated/gtksymboliccolor.c b/gtk/deprecated/gtksymboliccolor.c
new file mode 100644 (file)
index 0000000..db85a3b
--- /dev/null
@@ -0,0 +1,359 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#define GDK_DISABLE_DEPRECATION_WARNINGS
+
+#include "gtkcsscolorvalueprivate.h"
+#include "gtkcssrgbavalueprivate.h"
+#include "gtkcssstylepropertyprivate.h"
+#include "gtkhslaprivate.h"
+#include "gtkstylepropertyprivate.h"
+#include "gtksymboliccolorprivate.h"
+#include "gtkstyleproperties.h"
+#include "gtkintl.h"
+#include "gtkwin32themeprivate.h"
+
+/**
+ * SECTION:gtksymboliccolor
+ * @Short_description: Symbolic colors
+ * @Title: GtkSymbolicColor
+ *
+ * GtkSymbolicColor is a boxed type that represents a symbolic color.
+ * It is the result of parsing a
+ * <link linkend="gtkcssprovider-symbolic-colors">color expression</link>.
+ * To obtain the color represented by a GtkSymbolicColor, it has to
+ * be resolved with gtk_symbolic_color_resolve(), which replaces all
+ * symbolic color references by the colors they refer to (in a given
+ * context) and evaluates mix, shade and other expressions, resulting
+ * in a #GdkRGBA value.
+ *
+ * It is not normally necessary to deal directly with #GtkSymbolicColors,
+ * since they are mostly used behind the scenes by #GtkStyleContext and
+ * #GtkCssProvider.
+ *
+ * #GtkSymbolicColor is deprecated. Symbolic colors are considered an
+ * implementation detail of GTK+.
+ */
+
+G_DEFINE_BOXED_TYPE (GtkSymbolicColor, gtk_symbolic_color,
+                     gtk_symbolic_color_ref, gtk_symbolic_color_unref)
+
+struct _GtkSymbolicColor
+{
+  GtkCssValue *value;
+  gint ref_count;
+};
+
+static GtkSymbolicColor *
+gtk_symbolic_color_new (GtkCssValue *value)
+{
+  GtkSymbolicColor *symbolic;
+
+  symbolic = g_slice_new0 (GtkSymbolicColor);
+  symbolic->value = value;
+  symbolic->ref_count = 1;
+
+  return symbolic;
+}
+
+/**
+ * gtk_symbolic_color_new_literal:
+ * @color: a #GdkRGBA
+ *
+ * Creates a symbolic color pointing to a literal color.
+ *
+ * Returns: a newly created #GtkSymbolicColor
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+GtkSymbolicColor *
+gtk_symbolic_color_new_literal (const GdkRGBA *color)
+{
+  g_return_val_if_fail (color != NULL, NULL);
+
+  return gtk_symbolic_color_new (_gtk_css_color_value_new_literal (color));
+}
+
+/**
+ * gtk_symbolic_color_new_name:
+ * @name: color name
+ *
+ * Creates a symbolic color pointing to an unresolved named
+ * color. See gtk_style_context_lookup_color() and
+ * gtk_style_properties_lookup_color().
+ *
+ * Returns: a newly created #GtkSymbolicColor
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+GtkSymbolicColor *
+gtk_symbolic_color_new_name (const gchar *name)
+{
+  g_return_val_if_fail (name != NULL, NULL);
+
+  return gtk_symbolic_color_new (_gtk_css_color_value_new_name (name));
+}
+
+/**
+ * gtk_symbolic_color_new_shade: (constructor)
+ * @color: another #GtkSymbolicColor
+ * @factor: shading factor to apply to @color
+ *
+ * Creates a symbolic color defined as a shade of
+ * another color. A factor > 1.0 would resolve to
+ * a brighter color, while < 1.0 would resolve to
+ * a darker color.
+ *
+ * Returns: A newly created #GtkSymbolicColor
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+GtkSymbolicColor *
+gtk_symbolic_color_new_shade (GtkSymbolicColor *color,
+                              gdouble           factor)
+{
+  g_return_val_if_fail (color != NULL, NULL);
+
+  return gtk_symbolic_color_new (_gtk_css_color_value_new_shade (color->value,
+                                                                 factor));
+}
+
+/**
+ * gtk_symbolic_color_new_alpha: (constructor)
+ * @color: another #GtkSymbolicColor
+ * @factor: factor to apply to @color alpha
+ *
+ * Creates a symbolic color by modifying the relative alpha
+ * value of @color. A factor < 1.0 would resolve to a more
+ * transparent color, while > 1.0 would resolve to a more
+ * opaque color.
+ *
+ * Returns: A newly created #GtkSymbolicColor
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+GtkSymbolicColor *
+gtk_symbolic_color_new_alpha (GtkSymbolicColor *color,
+                              gdouble           factor)
+{
+  g_return_val_if_fail (color != NULL, NULL);
+
+  return gtk_symbolic_color_new (_gtk_css_color_value_new_alpha (color->value,
+                                                                 factor));
+}
+
+/**
+ * gtk_symbolic_color_new_mix: (constructor)
+ * @color1: color to mix
+ * @color2: another color to mix
+ * @factor: mix factor
+ *
+ * Creates a symbolic color defined as a mix of another
+ * two colors. a mix factor of 0 would resolve to @color1,
+ * while a factor of 1 would resolve to @color2.
+ *
+ * Returns: A newly created #GtkSymbolicColor
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+GtkSymbolicColor *
+gtk_symbolic_color_new_mix (GtkSymbolicColor *color1,
+                            GtkSymbolicColor *color2,
+                            gdouble           factor)
+{
+  g_return_val_if_fail (color1 != NULL, NULL);
+  g_return_val_if_fail (color1 != NULL, NULL);
+
+  return gtk_symbolic_color_new (_gtk_css_color_value_new_mix (color1->value,
+                                                               color2->value,
+                                                               factor));
+}
+
+/**
+ * gtk_symbolic_color_new_win32: (constructor)
+ * @theme_class: The theme class to pull color from
+ * @id: The color id
+ *
+ * Creates a symbolic color based on the current win32
+ * theme.
+ *
+ * Note that while this call is available on all platforms
+ * the actual value returned is not reliable on non-win32
+ * platforms.
+ *
+ * Returns: A newly created #GtkSymbolicColor
+ *
+ * Since: 3.4
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ */
+GtkSymbolicColor *
+gtk_symbolic_color_new_win32 (const gchar *theme_class,
+                              gint         id)
+{
+  g_return_val_if_fail (theme_class != NULL, NULL);
+
+  return gtk_symbolic_color_new (_gtk_css_color_value_new_win32 (theme_class, id));
+}
+
+/**
+ * gtk_symbolic_color_ref:
+ * @color: a #GtkSymbolicColor
+ *
+ * Increases the reference count of @color
+ *
+ * Returns: the same @color
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+GtkSymbolicColor *
+gtk_symbolic_color_ref (GtkSymbolicColor *color)
+{
+  g_return_val_if_fail (color != NULL, NULL);
+
+  color->ref_count++;
+
+  return color;
+}
+
+/**
+ * gtk_symbolic_color_unref:
+ * @color: a #GtkSymbolicColor
+ *
+ * Decreases the reference count of @color, freeing its memory if the
+ * reference count reaches 0.
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+void
+gtk_symbolic_color_unref (GtkSymbolicColor *color)
+{
+  g_return_if_fail (color != NULL);
+
+  if (--color->ref_count)
+    return;
+
+  _gtk_css_value_unref (color->value);
+
+  g_slice_free (GtkSymbolicColor, color);
+}
+
+/**
+ * gtk_symbolic_color_resolve:
+ * @color: a #GtkSymbolicColor
+ * @props: (allow-none): #GtkStyleProperties to use when resolving
+ *    named colors, or %NULL
+ * @resolved_color: (out): return location for the resolved color
+ *
+ * If @color is resolvable, @resolved_color will be filled in
+ * with the resolved color, and %TRUE will be returned. Generally,
+ * if @color can't be resolved, it is due to it being defined on
+ * top of a named color that doesn't exist in @props.
+ *
+ * When @props is %NULL, resolving of named colors will fail, so if
+ * your @color is or references such a color, this function will
+ * return %FALSE.
+ *
+ * Returns: %TRUE if the color has been resolved
+ *
+ * Since: 3.0
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+gboolean
+gtk_symbolic_color_resolve (GtkSymbolicColor   *color,
+                           GtkStyleProperties *props,
+                           GdkRGBA            *resolved_color)
+{
+  GdkRGBA pink = { 1.0, 0.5, 0.5, 1.0 };
+  GtkCssValue *v, *current;
+
+  g_return_val_if_fail (color != NULL, FALSE);
+  g_return_val_if_fail (resolved_color != NULL, FALSE);
+  g_return_val_if_fail (props == NULL || GTK_IS_STYLE_PROPERTIES (props), FALSE);
+
+  current = _gtk_css_rgba_value_new_from_rgba (&pink);
+  v = _gtk_css_color_value_resolve (color->value,
+                                    GTK_STYLE_PROVIDER_PRIVATE (props),
+                                    current,
+                                    0,
+                                    NULL);
+  _gtk_css_value_unref (current);
+  if (v == NULL)
+    return FALSE;
+
+  *resolved_color = *_gtk_css_rgba_value_get_rgba (v);
+  _gtk_css_value_unref (v);
+  return TRUE;
+}
+
+/**
+ * gtk_symbolic_color_to_string:
+ * @color: color to convert to a string
+ *
+ * Converts the given @color to a string representation. This is useful
+ * both for debugging and for serialization of strings. The format of
+ * the string may change between different versions of GTK, but it is
+ * guaranteed that the GTK css parser is able to read the string and
+ * create the same symbolic color from it.
+ *
+ * Returns: a new string representing @color
+ *
+ * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
+ **/
+char *
+gtk_symbolic_color_to_string (GtkSymbolicColor *color)
+{
+  g_return_val_if_fail (color != NULL, NULL);
+
+  return _gtk_css_value_to_string (color->value);
+}
+
+GtkSymbolicColor *
+_gtk_css_symbolic_value_new (GtkCssParser *parser)
+{
+  GtkCssValue *value;
+
+  value = _gtk_css_color_value_parse (parser);
+  if (value == NULL)
+    return NULL;
+
+  return gtk_symbolic_color_new (value);
+}
+
+GtkCssValue *
+_gtk_symbolic_color_get_css_value (GtkSymbolicColor *symbolic)
+{
+  return symbolic->value;
+}
+
diff --git a/gtk/deprecated/gtksymboliccolor.h b/gtk/deprecated/gtksymboliccolor.h
new file mode 100644 (file)
index 0000000..937f935
--- /dev/null
@@ -0,0 +1,67 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
+#error "Only <gtk/gtk.h> can be included directly."
+#endif
+
+#ifndef __GTK_SYMBOLIC_COLOR_H__
+#define __GTK_SYMBOLIC_COLOR_H__
+
+#include <gdk/gdk.h>
+#include <gtk/gtkstyleproperties.h>
+
+G_BEGIN_DECLS
+
+#define GTK_TYPE_SYMBOLIC_COLOR (gtk_symbolic_color_get_type ())
+
+GType              gtk_symbolic_color_get_type    (void) G_GNUC_CONST;
+
+GDK_DEPRECATED_IN_3_8
+GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA      *color);
+GDK_DEPRECATED_IN_3_8
+GtkSymbolicColor * gtk_symbolic_color_new_name    (const gchar        *name);
+GDK_DEPRECATED_IN_3_8
+GtkSymbolicColor * gtk_symbolic_color_new_shade   (GtkSymbolicColor   *color,
+                                                   gdouble             factor);
+GDK_DEPRECATED_IN_3_8
+GtkSymbolicColor * gtk_symbolic_color_new_alpha   (GtkSymbolicColor   *color,
+                                                   gdouble             factor);
+GDK_DEPRECATED_IN_3_8
+GtkSymbolicColor * gtk_symbolic_color_new_mix     (GtkSymbolicColor   *color1,
+                                                   GtkSymbolicColor   *color2,
+                                                   gdouble             factor);
+GDK_DEPRECATED_IN_3_8
+GtkSymbolicColor * gtk_symbolic_color_new_win32   (const gchar        *theme_class,
+                                                   gint                id);
+
+GDK_DEPRECATED_IN_3_8
+GtkSymbolicColor * gtk_symbolic_color_ref         (GtkSymbolicColor   *color);
+GDK_DEPRECATED_IN_3_8
+void               gtk_symbolic_color_unref       (GtkSymbolicColor   *color);
+
+GDK_DEPRECATED_IN_3_8
+char *             gtk_symbolic_color_to_string   (GtkSymbolicColor   *color);
+
+GDK_DEPRECATED_IN_3_8
+gboolean           gtk_symbolic_color_resolve     (GtkSymbolicColor   *color,
+                                                   GtkStyleProperties *props,
+                                                   GdkRGBA            *resolved_color);
+
+G_END_DECLS
+
+#endif /* __GTK_SYMBOLIC_COLOR_H__ */
diff --git a/gtk/deprecated/gtksymboliccolorprivate.h b/gtk/deprecated/gtksymboliccolorprivate.h
new file mode 100644 (file)
index 0000000..abbee19
--- /dev/null
@@ -0,0 +1,33 @@
+/* GTK - The GIMP Toolkit
+ * Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GTK_SYMBOLIC_COLOR_PRIVATE_H__
+#define __GTK_SYMBOLIC_COLOR_PRIVATE_H__
+
+#include "gtk/deprecated/gtksymboliccolor.h"
+#include "gtk/gtkcssparserprivate.h"
+#include "gtk/gtkcssvalueprivate.h"
+
+G_BEGIN_DECLS
+
+GtkSymbolicColor * _gtk_css_symbolic_value_new            (GtkCssParser               *parser);
+
+GtkCssValue *      _gtk_symbolic_color_get_css_value      (GtkSymbolicColor           *symbolic);
+
+G_END_DECLS
+
+#endif /* __GTK_SYMBOLIC_COLOR_PRIVATE_H__ */
index bd9d5f4ae5b86ce2694873390ac23aeffc6e1d97..fbc06a364176a3bca21c3474e32b73dfbaced824 100644 (file)
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
 #include <gtk/gtkfontchooserdialog.h>
 #include <gtk/gtkfontchooserwidget.h>
 #include <gtk/gtkframe.h>
-#include <gtk/gtkgradient.h>
 #include <gtk/gtkgrid.h>
 #include <gtk/gtkiconfactory.h>
 #include <gtk/gtkicontheme.h>
 #include <gtk/gtkstyleproperties.h>
 #include <gtk/gtkstyleprovider.h>
 #include <gtk/gtkswitch.h>
-#include <gtk/gtksymboliccolor.h>
 #include <gtk/gtktextattributes.h>
 #include <gtk/gtktextbuffer.h>
 #include <gtk/gtktextbufferrichtext.h>
 #include <gtk/deprecated/gtkcolorsel.h>
 #include <gtk/deprecated/gtkcolorseldialog.h>
 #include <gtk/deprecated/gtkfontsel.h>
+#include <gtk/deprecated/gtkgradient.h>
 #include <gtk/deprecated/gtkhandlebox.h>
 #include <gtk/deprecated/gtkhbbox.h>
 #include <gtk/deprecated/gtkhbox.h>
 #include <gtk/deprecated/gtkhseparator.h>
 #include <gtk/deprecated/gtkrc.h>
 #include <gtk/deprecated/gtkstyle.h>
+#include <gtk/deprecated/gtksymboliccolor.h>
 #include <gtk/deprecated/gtktable.h>
 #include <gtk/deprecated/gtktearoffmenuitem.h>
 #include <gtk/deprecated/gtkvbbox.h>
index 06337869b07068a045f7652b545053a3d32decf5..0486e28f605de7f6182ecfbabf82eab5490453d8 100644 (file)
@@ -24,7 +24,6 @@
 #include "gtkhslaprivate.h"
 #include "gtkstylepropertyprivate.h"
 #include "gtkstyleproperties.h"
-#include "gtksymboliccolorprivate.h"
 #include "gtkwin32themeprivate.h"
 
 typedef enum {
index 1a304afb47e80b58baa41c08838c4b7e59c84a77..017a8a22e18af3860f506ac14c7f8bf21932165a 100644 (file)
 #include "gtkcssstylefuncsprivate.h"
 #include "gtkcsstypedvalueprivate.h"
 #include "gtkstylepropertiesprivate.h"
-#include "gtksymboliccolor.h"
 #include "gtkthemingengine.h"
 
+#include "deprecated/gtksymboliccolor.h"
+
 G_DEFINE_TYPE (GtkCssCustomProperty, _gtk_css_custom_property, GTK_TYPE_CSS_STYLE_PROPERTY)
 
 static GType
index fa6aacf2aba82d029bdd066649fcb42c913b189f..cc06c904c9533f243301c8db75a6b69d73685c7c 100644 (file)
@@ -24,8 +24,9 @@
 #include "gtkcssimagegradientprivate.h"
 
 #include "gtkcssprovider.h"
-#include "gtkgradientprivate.h"
-#include "gtksymboliccolorprivate.h"
+
+#include "deprecated/gtkgradientprivate.h"
+#include "deprecated/gtksymboliccolorprivate.h"
 
 G_DEFINE_TYPE (GtkCssImageGradient, _gtk_css_image_gradient, GTK_TYPE_CSS_IMAGE)
 
index 6ab2cbd86587e34a58772608df549a2cbb67b4ab..48754357a2ecc4a09825cc159d014943bb8bf0b7 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "gtk/gtkcssimageprivate.h"
 
-#include <gtk/gtkgradient.h>
+#include <gtk/deprecated/gtkgradient.h>
 
 G_BEGIN_DECLS
 
index f399881f9fc6c29fbba871e64ee7443ad6445403..af1c1b1b6f41262fdd95bc713c15bdbcf595ebde 100644 (file)
 #include "gtkcssrgbavalueprivate.h"
 #include "gtkcsstypedvalueprivate.h"
 #include "gtkcsstypesprivate.h"
-#include "gtkgradient.h"
-#include "gtkgradientprivate.h"
 #include "gtkprivatetypebuiltins.h"
 #include "gtkstylecontextprivate.h"
-#include "gtksymboliccolorprivate.h"
 #include "gtkthemingengine.h"
 #include "gtktypebuiltins.h"
 #include "gtkwin32themeprivate.h"
 
+#include "deprecated/gtkgradientprivate.h"
+#include "deprecated/gtksymboliccolorprivate.h"
+
 /* this is in case round() is not provided by the compiler, 
  * such as in the case of C89 compilers, like MSVC
  */
diff --git a/gtk/gtkgradient.c b/gtk/gtkgradient.c
deleted file mode 100644 (file)
index 78cf7a3..0000000
+++ /dev/null
@@ -1,551 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#define GDK_DISABLE_DEPRECATION_WARNINGS
-
-#include "gtkgradientprivate.h"
-
-#include "gtkcsscolorvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
-#include "gtkstylecontextprivate.h"
-#include "gtkstyleproperties.h"
-#include "gtksymboliccolorprivate.h"
-
-/**
- * SECTION:gtkgradient
- * @Short_description: Gradients
- * @Title: GtkGradient
- *
- * GtkGradient is a boxed type that represents a gradient.
- * It is the result of parsing a
- * <link linkend="gtkcssprovider-gradients">gradient expression</link>.
- * To obtain the gradient represented by a GtkGradient, it has to
- * be resolved with gtk_gradient_resolve(), which replaces all
- * symbolic color references by the colors they refer to (in a given
- * context) and constructs a #cairo_pattern_t value.
- *
- * It is not normally necessary to deal directly with #GtkGradients,
- * since they are mostly used behind the scenes by #GtkStyleContext and
- * #GtkCssProvider.
- *
- * #GtkGradient is deprecated. It was used internally by GTK's CSS engine
- * to represent gradients. As its handling is not conforming to modern
- * web standards, it is not used anymore. If you want to use gradients in
- * your own code, please use Cairo directly.
- */
-
-G_DEFINE_BOXED_TYPE (GtkGradient, gtk_gradient,
-                     gtk_gradient_ref, gtk_gradient_unref)
-
-typedef struct ColorStop ColorStop;
-
-struct ColorStop
-{
-  gdouble offset;
-  GtkSymbolicColor *color;
-};
-
-struct _GtkGradient
-{
-  gdouble x0;
-  gdouble y0;
-  gdouble x1;
-  gdouble y1;
-  gdouble radius0;
-  gdouble radius1;
-
-  GArray *stops;
-
-  guint ref_count;
-};
-
-/**
- * gtk_gradient_new_linear:
- * @x0: X coordinate of the starting point
- * @y0: Y coordinate of the starting point
- * @x1: X coordinate of the end point
- * @y1: Y coordinate of the end point
- *
- * Creates a new linear gradient along the line defined by (x0, y0) and (x1, y1). Before using the gradient
- * a number of stop colors must be added through gtk_gradient_add_color_stop().
- *
- * Returns: A newly created #GtkGradient
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkGradient is deprecated.
- **/
-GtkGradient *
-gtk_gradient_new_linear (gdouble x0,
-                         gdouble y0,
-                         gdouble x1,
-                         gdouble y1)
-{
-  GtkGradient *gradient;
-
-  gradient = g_slice_new (GtkGradient);
-  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
-
-  gradient->x0 = x0;
-  gradient->y0 = y0;
-  gradient->x1 = x1;
-  gradient->y1 = y1;
-  gradient->radius0 = 0;
-  gradient->radius1 = 0;
-
-  gradient->ref_count = 1;
-
-  return gradient;
-}
-
-/**
- * gtk_gradient_new_radial:
- * @x0: X coordinate of the start circle
- * @y0: Y coordinate of the start circle
- * @radius0: radius of the start circle
- * @x1: X coordinate of the end circle
- * @y1: Y coordinate of the end circle
- * @radius1: radius of the end circle
- *
- * Creates a new radial gradient along the two circles defined by (x0, y0, radius0) and
- * (x1, y1, radius1). Before using the gradient a number of stop colors must be added
- * through gtk_gradient_add_color_stop().
- *
- * Returns: A newly created #GtkGradient
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkGradient is deprecated.
- **/
-GtkGradient *
-gtk_gradient_new_radial (gdouble x0,
-                        gdouble y0,
-                        gdouble radius0,
-                        gdouble x1,
-                        gdouble y1,
-                        gdouble radius1)
-{
-  GtkGradient *gradient;
-
-  gradient = g_slice_new (GtkGradient);
-  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
-
-  gradient->x0 = x0;
-  gradient->y0 = y0;
-  gradient->x1 = x1;
-  gradient->y1 = y1;
-  gradient->radius0 = radius0;
-  gradient->radius1 = radius1;
-
-  gradient->ref_count = 1;
-
-  return gradient;
-}
-
-/**
- * gtk_gradient_add_color_stop:
- * @gradient: a #GtkGradient
- * @offset: offset for the color stop
- * @color: color to use
- *
- * Adds a stop color to @gradient.
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkGradient is deprecated.
- **/
-void
-gtk_gradient_add_color_stop (GtkGradient      *gradient,
-                             gdouble           offset,
-                             GtkSymbolicColor *color)
-{
-  ColorStop stop;
-
-  g_return_if_fail (gradient != NULL);
-
-  stop.offset = offset;
-  stop.color = gtk_symbolic_color_ref (color);
-
-  g_array_append_val (gradient->stops, stop);
-}
-
-/**
- * gtk_gradient_ref:
- * @gradient: a #GtkGradient
- *
- * Increases the reference count of @gradient.
- *
- * Returns: The same @gradient
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkGradient is deprecated.
- **/
-GtkGradient *
-gtk_gradient_ref (GtkGradient *gradient)
-{
-  g_return_val_if_fail (gradient != NULL, NULL);
-
-  gradient->ref_count++;
-
-  return gradient;
-}
-
-/**
- * gtk_gradient_unref:
- * @gradient: a #GtkGradient
- *
- * Decreases the reference count of @gradient, freeing its memory
- * if the reference count reaches 0.
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkGradient is deprecated.
- **/
-void
-gtk_gradient_unref (GtkGradient *gradient)
-{
-  g_return_if_fail (gradient != NULL);
-
-  gradient->ref_count--;
-
-  if (gradient->ref_count == 0)
-    {
-      guint i;
-
-      for (i = 0; i < gradient->stops->len; i++)
-        {
-          ColorStop *stop;
-
-          stop = &g_array_index (gradient->stops, ColorStop, i);
-          gtk_symbolic_color_unref (stop->color);
-        }
-
-      g_array_free (gradient->stops, TRUE);
-      g_slice_free (GtkGradient, gradient);
-    }
-}
-
-/**
- * gtk_gradient_resolve:
- * @gradient: a #GtkGradient
- * @props: #GtkStyleProperties to use when resolving named colors
- * @resolved_gradient: (out): return location for the resolved pattern
- *
- * If @gradient is resolvable, @resolved_gradient will be filled in
- * with the resolved gradient as a cairo_pattern_t, and %TRUE will
- * be returned. Generally, if @gradient can't be resolved, it is
- * due to it being defined on top of a named color that doesn't
- * exist in @props.
- *
- * Returns: %TRUE if the gradient has been resolved
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkGradient is deprecated.
- **/
-gboolean
-gtk_gradient_resolve (GtkGradient         *gradient,
-                      GtkStyleProperties  *props,
-                      cairo_pattern_t    **resolved_gradient)
-{
-  cairo_pattern_t *pattern;
-  guint i;
-
-  g_return_val_if_fail (gradient != NULL, FALSE);
-  g_return_val_if_fail (GTK_IS_STYLE_PROPERTIES (props), FALSE);
-  g_return_val_if_fail (resolved_gradient != NULL, FALSE);
-
-  if (gradient->radius0 == 0 && gradient->radius1 == 0)
-    pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
-                                           gradient->x1, gradient->y1);
-  else
-    pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0,
-                                           gradient->radius0,
-                                           gradient->x1, gradient->y1,
-                                           gradient->radius1);
-
-  for (i = 0; i < gradient->stops->len; i++)
-    {
-      ColorStop *stop;
-      GdkRGBA color;
-
-      stop = &g_array_index (gradient->stops, ColorStop, i);
-
-      if (!gtk_symbolic_color_resolve (stop->color, props, &color))
-        {
-          cairo_pattern_destroy (pattern);
-          return FALSE;
-        }
-
-      cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
-                                         color.red, color.green,
-                                         color.blue, color.alpha);
-    }
-
-  *resolved_gradient = pattern;
-  return TRUE;
-}
-
-cairo_pattern_t *
-_gtk_gradient_resolve_full (GtkGradient             *gradient,
-                            GtkStyleProviderPrivate *provider,
-                            GtkCssComputedValues    *values,
-                            GtkCssComputedValues    *parent_values,
-                            GtkCssDependencies      *dependencies)
-{
-  cairo_pattern_t *pattern;
-  guint i;
-
-  g_return_val_if_fail (gradient != NULL, NULL);
-  g_return_val_if_fail (GTK_IS_STYLE_PROVIDER (provider), NULL);
-  g_return_val_if_fail (GTK_IS_CSS_COMPUTED_VALUES (values), NULL);
-  g_return_val_if_fail (parent_values == NULL || GTK_IS_CSS_COMPUTED_VALUES (parent_values), NULL);
-  g_return_val_if_fail (*dependencies == 0, NULL);
-
-  if (gradient->radius0 == 0 && gradient->radius1 == 0)
-    pattern = cairo_pattern_create_linear (gradient->x0, gradient->y0,
-                                           gradient->x1, gradient->y1);
-  else
-    pattern = cairo_pattern_create_radial (gradient->x0, gradient->y0,
-                                           gradient->radius0,
-                                           gradient->x1, gradient->y1,
-                                           gradient->radius1);
-
-  for (i = 0; i < gradient->stops->len; i++)
-    {
-      ColorStop *stop;
-      GtkCssValue *val;
-      GdkRGBA rgba;
-      GtkCssDependencies stop_deps;
-
-      stop = &g_array_index (gradient->stops, ColorStop, i);
-
-      /* if color resolving fails, assume transparency */
-      val = _gtk_css_color_value_resolve (_gtk_symbolic_color_get_css_value (stop->color),
-                                          provider,
-                                          _gtk_css_computed_values_get_value (values, GTK_CSS_PROPERTY_COLOR),
-                                          GTK_CSS_DEPENDS_ON_COLOR,
-                                          &stop_deps);
-      if (val)
-        {
-          rgba = *_gtk_css_rgba_value_get_rgba (val);
-          *dependencies = _gtk_css_dependencies_union (*dependencies, stop_deps);
-          _gtk_css_value_unref (val);
-        }
-      else
-        {
-          rgba.red = rgba.green = rgba.blue = rgba.alpha = 0.0;
-        }
-
-      cairo_pattern_add_color_stop_rgba (pattern, stop->offset,
-                                         rgba.red, rgba.green,
-                                         rgba.blue, rgba.alpha);
-    }
-
-  return pattern;
-}
-
-static void
-append_number (GString    *str,
-               double      d,
-               const char *zero,
-               const char *half,
-               const char *one)
-{
-  if (zero && d == 0.0)
-    g_string_append (str, zero);
-  else if (half && d == 0.5)
-    g_string_append (str, half);
-  else if (one && d == 1.0)
-    g_string_append (str, one);
-  else
-    {
-      char buf[G_ASCII_DTOSTR_BUF_SIZE];
-
-      g_ascii_dtostr (buf, sizeof (buf), d);
-      g_string_append (str, buf);
-    }
-}
-
-/**
- * gtk_gradient_to_string:
- * @gradient: the gradient to print
- *
- * Creates a string representation for @gradient that is suitable
- * for using in GTK CSS files.
- *
- * Returns: A string representation for @gradient
- *
- * Deprecated: 3.8: #GtkGradient is deprecated.
- **/
-char *
-gtk_gradient_to_string (GtkGradient *gradient)
-{
-  GString *str;
-  guint i;
-
-  g_return_val_if_fail (gradient != NULL, NULL);
-
-  str = g_string_new ("-gtk-gradient (");
-
-  if (gradient->radius0 == 0 && gradient->radius1 == 0)
-    {
-      g_string_append (str, "linear, ");
-      append_number (str, gradient->x0, "left", "center", "right");
-      g_string_append_c (str, ' ');
-      append_number (str, gradient->y0, "top", "center", "bottom");
-      g_string_append (str, ", ");
-      append_number (str, gradient->x1, "left", "center", "right");
-      g_string_append_c (str, ' ');
-      append_number (str, gradient->y1, "top", "center", "bottom");
-    }
-  else
-    {
-      g_string_append (str, "radial, ");
-      append_number (str, gradient->x0, "left", "center", "right");
-      g_string_append_c (str, ' ');
-      append_number (str, gradient->y0, "top", "center", "bottom");
-      g_string_append (str, ", ");
-      append_number (str, gradient->radius0, NULL, NULL, NULL);
-      g_string_append (str, ", ");
-      append_number (str, gradient->x1, "left", "center", "right");
-      g_string_append_c (str, ' ');
-      append_number (str, gradient->y1, "top", "center", "bottom");
-      g_string_append (str, ", ");
-      append_number (str, gradient->radius1, NULL, NULL, NULL);
-    }
-  
-  for (i = 0; i < gradient->stops->len; i++)
-    {
-      ColorStop *stop;
-      char *s;
-
-      stop = &g_array_index (gradient->stops, ColorStop, i);
-
-      g_string_append (str, ", ");
-
-      if (stop->offset == 0.0)
-        g_string_append (str, "from (");
-      else if (stop->offset == 1.0)
-        g_string_append (str, "to (");
-      else
-        {
-          g_string_append (str, "color-stop (");
-          append_number (str, stop->offset, NULL, NULL, NULL);
-          g_string_append (str, ", ");
-        }
-
-      s = gtk_symbolic_color_to_string (stop->color);
-      g_string_append (str, s);
-      g_free (s);
-
-      g_string_append (str, ")");
-    }
-
-  g_string_append (str, ")");
-
-  return g_string_free (str, FALSE);
-}
-
-static GtkGradient *
-gtk_gradient_fade (GtkGradient *gradient,
-                   double       opacity)
-{
-  GtkGradient *faded;
-  guint i;
-
-  faded = g_slice_new (GtkGradient);
-  faded->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
-
-  faded->x0 = gradient->x0;
-  faded->y0 = gradient->y0;
-  faded->x1 = gradient->x1;
-  faded->y1 = gradient->y1;
-  faded->radius0 = gradient->radius0;
-  faded->radius1 = gradient->radius1;
-
-  faded->ref_count = 1;
-
-  for (i = 0; i < gradient->stops->len; i++)
-    {
-      GtkSymbolicColor *color;
-      ColorStop *stop;
-
-      stop = &g_array_index (gradient->stops, ColorStop, i);
-      color = gtk_symbolic_color_new_alpha (stop->color, opacity);
-      gtk_gradient_add_color_stop (faded, stop->offset, color);
-      gtk_symbolic_color_unref (color);
-    }
-
-  return faded;
-}
-
-GtkGradient *
-_gtk_gradient_transition (GtkGradient *start,
-                          GtkGradient *end,
-                          guint        property_id,
-                          double       progress)
-{
-  GtkGradient *gradient;
-  guint i;
-
-  g_return_val_if_fail (start != NULL, NULL);
-
-  if (end == NULL)
-    return gtk_gradient_fade (start, 1.0 - CLAMP (progress, 0.0, 1.0));
-
-  if (start->stops->len != end->stops->len)
-    return NULL;
-
-  /* check both are radial/linear */
-  if ((start->radius0 == 0 && start->radius1 == 0) != (end->radius0 == 0 && end->radius1 == 0))
-    return NULL;
-
-  gradient = g_slice_new (GtkGradient);
-  gradient->stops = g_array_new (FALSE, FALSE, sizeof (ColorStop));
-
-  gradient->x0 = (1 - progress) * start->x0 + progress * end->x0;
-  gradient->y0 = (1 - progress) * start->y0 + progress * end->y0;
-  gradient->x1 = (1 - progress) * start->x1 + progress * end->x1;
-  gradient->y1 = (1 - progress) * start->y1 + progress * end->y1;
-  gradient->radius0 = (1 - progress) * start->radius0 + progress * end->radius0;
-  gradient->radius1 = (1 - progress) * start->radius1 + progress * end->radius1;
-
-  gradient->ref_count = 1;
-
-  for (i = 0; i < start->stops->len; i++)
-    {
-      ColorStop *start_stop, *end_stop;
-      GtkSymbolicColor *color;
-      double offset;
-
-      start_stop = &g_array_index (start->stops, ColorStop, i);
-      end_stop = &g_array_index (end->stops, ColorStop, i);
-
-      offset = (1 - progress) * start_stop->offset + progress * end_stop->offset;
-      color = gtk_symbolic_color_new_mix (start_stop->color,
-                                          end_stop->color,
-                                          progress);
-      gtk_gradient_add_color_stop (gradient, offset, color);
-      gtk_symbolic_color_unref (color);
-    }
-
-  return gradient;
-}
diff --git a/gtk/gtkgradient.h b/gtk/gtkgradient.h
deleted file mode 100644 (file)
index 52bbb2e..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_GRADIENT_H__
-#define __GTK_GRADIENT_H__
-
-#include <gdk/gdk.h>
-#include <gtk/gtkstylecontext.h>
-#include <gtk/gtkstyleproperties.h>
-#include <gtk/gtksymboliccolor.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_GRADIENT (gtk_gradient_get_type ())
-
-GType         gtk_gradient_get_type       (void) G_GNUC_CONST;
-
-GDK_DEPRECATED_IN_3_8
-GtkGradient * gtk_gradient_new_linear     (gdouble              x0,
-                                           gdouble              y0,
-                                           gdouble              x1,
-                                           gdouble              y1);
-GDK_DEPRECATED_IN_3_8
-GtkGradient * gtk_gradient_new_radial     (gdouble              x0,
-                                           gdouble              y0,
-                                           gdouble              radius0,
-                                           gdouble              x1,
-                                           gdouble              y1,
-                                           gdouble              radius1);
-
-GDK_DEPRECATED_IN_3_8
-void          gtk_gradient_add_color_stop (GtkGradient         *gradient,
-                                           gdouble              offset,
-                                           GtkSymbolicColor    *color);
-
-GDK_DEPRECATED_IN_3_8
-GtkGradient * gtk_gradient_ref            (GtkGradient         *gradient);
-GDK_DEPRECATED_IN_3_8
-void          gtk_gradient_unref          (GtkGradient         *gradient);
-
-GDK_DEPRECATED_IN_3_8
-gboolean      gtk_gradient_resolve        (GtkGradient         *gradient,
-                                           GtkStyleProperties  *props,
-                                           cairo_pattern_t    **resolved_gradient);
-GDK_DEPRECATED_IN_3_8
-cairo_pattern_t *
-              gtk_gradient_resolve_for_context
-                                          (GtkGradient         *gradient,
-                                           GtkStyleContext     *context);
-
-GDK_DEPRECATED_IN_3_8
-char *        gtk_gradient_to_string      (GtkGradient         *gradient);
-
-G_END_DECLS
-
-#endif /* __GTK_GRADIENT_H__ */
diff --git a/gtk/gtkgradientprivate.h b/gtk/gtkgradientprivate.h
deleted file mode 100644 (file)
index 9cd37f2..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2012 Benjamin Otte <otte@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GTK_GRADIENT_PRIVATE_H__
-#define __GTK_GRADIENT_PRIVATE_H__
-
-#include "gtkgradient.h"
-#include "gtkcsstypesprivate.h"
-
-G_BEGIN_DECLS
-
-cairo_pattern_t *       _gtk_gradient_resolve_full            (GtkGradient             *gradient,
-                                                               GtkStyleProviderPrivate *provider,
-                                                               GtkCssComputedValues    *values,
-                                                               GtkCssComputedValues    *parent_values,
-                                                               GtkCssDependencies      *dependencies);
-
-GtkGradient *           _gtk_gradient_transition              (GtkGradient             *start,
-                                                               GtkGradient             *end,
-                                                               guint                    property_id,
-                                                               double                   progress);
-
-G_END_DECLS
-
-#endif /* __GTK_STYLE_PROPERTIES_PRIVATE_H__ */
index 46822e27dca592b1533eb4c4ddffef94c80536a2..8da3682125a5a3c22ba9ff075e589d3d43e2e4c6 100644 (file)
@@ -29,7 +29,6 @@
 #include "gtkcssnumbervalueprivate.h"
 #include "gtkcssrgbavalueprivate.h"
 #include "gtkdebug.h"
-#include "gtkgradientprivate.h"
 #include "gtkstylepropertiesprivate.h"
 #include "gtktypebuiltins.h"
 #include "gtkthemingengineprivate.h"
@@ -37,7 +36,6 @@
 #include "gtkwidget.h"
 #include "gtkwindow.h"
 #include "gtkprivate.h"
-#include "gtksymboliccolorprivate.h"
 #include "gtkiconfactory.h"
 #include "gtkwidgetpath.h"
 #include "gtkwidgetprivate.h"
@@ -46,6 +44,9 @@
 #include "gtksettings.h"
 #include "gtksettingsprivate.h"
 
+#include "deprecated/gtkgradientprivate.h"
+#include "deprecated/gtksymboliccolorprivate.h"
+
 /**
  * SECTION:gtkstylecontext
  * @Short_description: Rendering UI elements
index e98cd44c443f18cc69a16312135516f291d0ec07..9788006b1612f5dec65c947af8bdea3d25edf9dd 100644 (file)
@@ -24,9 +24,7 @@
 #include <cairo-gobject.h>
 
 #include "gtkstyleprovider.h"
-#include "gtksymboliccolor.h"
 #include "gtkthemingengine.h"
-#include "gtkgradient.h"
 #include "gtkcssshorthandpropertyprivate.h"
 #include "gtkcsstypedvalueprivate.h"
 #include "gtkcsstypesprivate.h"
 #include "gtkstylepropertyprivate.h"
 #include "gtkstyleproviderprivate.h"
 #include "gtkintl.h"
-
-#include "gtksymboliccolorprivate.h"
 #include "gtkwin32themeprivate.h"
 
+#include "deprecated/gtkgradient.h"
+#include "deprecated/gtksymboliccolorprivate.h"
+
 /**
  * SECTION:gtkstyleproperties
  * @Short_description: Store for style property information
diff --git a/gtk/gtksymboliccolor.c b/gtk/gtksymboliccolor.c
deleted file mode 100644 (file)
index db85a3b..0000000
+++ /dev/null
@@ -1,359 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "config.h"
-
-#define GDK_DISABLE_DEPRECATION_WARNINGS
-
-#include "gtkcsscolorvalueprivate.h"
-#include "gtkcssrgbavalueprivate.h"
-#include "gtkcssstylepropertyprivate.h"
-#include "gtkhslaprivate.h"
-#include "gtkstylepropertyprivate.h"
-#include "gtksymboliccolorprivate.h"
-#include "gtkstyleproperties.h"
-#include "gtkintl.h"
-#include "gtkwin32themeprivate.h"
-
-/**
- * SECTION:gtksymboliccolor
- * @Short_description: Symbolic colors
- * @Title: GtkSymbolicColor
- *
- * GtkSymbolicColor is a boxed type that represents a symbolic color.
- * It is the result of parsing a
- * <link linkend="gtkcssprovider-symbolic-colors">color expression</link>.
- * To obtain the color represented by a GtkSymbolicColor, it has to
- * be resolved with gtk_symbolic_color_resolve(), which replaces all
- * symbolic color references by the colors they refer to (in a given
- * context) and evaluates mix, shade and other expressions, resulting
- * in a #GdkRGBA value.
- *
- * It is not normally necessary to deal directly with #GtkSymbolicColors,
- * since they are mostly used behind the scenes by #GtkStyleContext and
- * #GtkCssProvider.
- *
- * #GtkSymbolicColor is deprecated. Symbolic colors are considered an
- * implementation detail of GTK+.
- */
-
-G_DEFINE_BOXED_TYPE (GtkSymbolicColor, gtk_symbolic_color,
-                     gtk_symbolic_color_ref, gtk_symbolic_color_unref)
-
-struct _GtkSymbolicColor
-{
-  GtkCssValue *value;
-  gint ref_count;
-};
-
-static GtkSymbolicColor *
-gtk_symbolic_color_new (GtkCssValue *value)
-{
-  GtkSymbolicColor *symbolic;
-
-  symbolic = g_slice_new0 (GtkSymbolicColor);
-  symbolic->value = value;
-  symbolic->ref_count = 1;
-
-  return symbolic;
-}
-
-/**
- * gtk_symbolic_color_new_literal:
- * @color: a #GdkRGBA
- *
- * Creates a symbolic color pointing to a literal color.
- *
- * Returns: a newly created #GtkSymbolicColor
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-GtkSymbolicColor *
-gtk_symbolic_color_new_literal (const GdkRGBA *color)
-{
-  g_return_val_if_fail (color != NULL, NULL);
-
-  return gtk_symbolic_color_new (_gtk_css_color_value_new_literal (color));
-}
-
-/**
- * gtk_symbolic_color_new_name:
- * @name: color name
- *
- * Creates a symbolic color pointing to an unresolved named
- * color. See gtk_style_context_lookup_color() and
- * gtk_style_properties_lookup_color().
- *
- * Returns: a newly created #GtkSymbolicColor
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-GtkSymbolicColor *
-gtk_symbolic_color_new_name (const gchar *name)
-{
-  g_return_val_if_fail (name != NULL, NULL);
-
-  return gtk_symbolic_color_new (_gtk_css_color_value_new_name (name));
-}
-
-/**
- * gtk_symbolic_color_new_shade: (constructor)
- * @color: another #GtkSymbolicColor
- * @factor: shading factor to apply to @color
- *
- * Creates a symbolic color defined as a shade of
- * another color. A factor > 1.0 would resolve to
- * a brighter color, while < 1.0 would resolve to
- * a darker color.
- *
- * Returns: A newly created #GtkSymbolicColor
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-GtkSymbolicColor *
-gtk_symbolic_color_new_shade (GtkSymbolicColor *color,
-                              gdouble           factor)
-{
-  g_return_val_if_fail (color != NULL, NULL);
-
-  return gtk_symbolic_color_new (_gtk_css_color_value_new_shade (color->value,
-                                                                 factor));
-}
-
-/**
- * gtk_symbolic_color_new_alpha: (constructor)
- * @color: another #GtkSymbolicColor
- * @factor: factor to apply to @color alpha
- *
- * Creates a symbolic color by modifying the relative alpha
- * value of @color. A factor < 1.0 would resolve to a more
- * transparent color, while > 1.0 would resolve to a more
- * opaque color.
- *
- * Returns: A newly created #GtkSymbolicColor
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-GtkSymbolicColor *
-gtk_symbolic_color_new_alpha (GtkSymbolicColor *color,
-                              gdouble           factor)
-{
-  g_return_val_if_fail (color != NULL, NULL);
-
-  return gtk_symbolic_color_new (_gtk_css_color_value_new_alpha (color->value,
-                                                                 factor));
-}
-
-/**
- * gtk_symbolic_color_new_mix: (constructor)
- * @color1: color to mix
- * @color2: another color to mix
- * @factor: mix factor
- *
- * Creates a symbolic color defined as a mix of another
- * two colors. a mix factor of 0 would resolve to @color1,
- * while a factor of 1 would resolve to @color2.
- *
- * Returns: A newly created #GtkSymbolicColor
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-GtkSymbolicColor *
-gtk_symbolic_color_new_mix (GtkSymbolicColor *color1,
-                            GtkSymbolicColor *color2,
-                            gdouble           factor)
-{
-  g_return_val_if_fail (color1 != NULL, NULL);
-  g_return_val_if_fail (color1 != NULL, NULL);
-
-  return gtk_symbolic_color_new (_gtk_css_color_value_new_mix (color1->value,
-                                                               color2->value,
-                                                               factor));
-}
-
-/**
- * gtk_symbolic_color_new_win32: (constructor)
- * @theme_class: The theme class to pull color from
- * @id: The color id
- *
- * Creates a symbolic color based on the current win32
- * theme.
- *
- * Note that while this call is available on all platforms
- * the actual value returned is not reliable on non-win32
- * platforms.
- *
- * Returns: A newly created #GtkSymbolicColor
- *
- * Since: 3.4
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- */
-GtkSymbolicColor *
-gtk_symbolic_color_new_win32 (const gchar *theme_class,
-                              gint         id)
-{
-  g_return_val_if_fail (theme_class != NULL, NULL);
-
-  return gtk_symbolic_color_new (_gtk_css_color_value_new_win32 (theme_class, id));
-}
-
-/**
- * gtk_symbolic_color_ref:
- * @color: a #GtkSymbolicColor
- *
- * Increases the reference count of @color
- *
- * Returns: the same @color
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-GtkSymbolicColor *
-gtk_symbolic_color_ref (GtkSymbolicColor *color)
-{
-  g_return_val_if_fail (color != NULL, NULL);
-
-  color->ref_count++;
-
-  return color;
-}
-
-/**
- * gtk_symbolic_color_unref:
- * @color: a #GtkSymbolicColor
- *
- * Decreases the reference count of @color, freeing its memory if the
- * reference count reaches 0.
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-void
-gtk_symbolic_color_unref (GtkSymbolicColor *color)
-{
-  g_return_if_fail (color != NULL);
-
-  if (--color->ref_count)
-    return;
-
-  _gtk_css_value_unref (color->value);
-
-  g_slice_free (GtkSymbolicColor, color);
-}
-
-/**
- * gtk_symbolic_color_resolve:
- * @color: a #GtkSymbolicColor
- * @props: (allow-none): #GtkStyleProperties to use when resolving
- *    named colors, or %NULL
- * @resolved_color: (out): return location for the resolved color
- *
- * If @color is resolvable, @resolved_color will be filled in
- * with the resolved color, and %TRUE will be returned. Generally,
- * if @color can't be resolved, it is due to it being defined on
- * top of a named color that doesn't exist in @props.
- *
- * When @props is %NULL, resolving of named colors will fail, so if
- * your @color is or references such a color, this function will
- * return %FALSE.
- *
- * Returns: %TRUE if the color has been resolved
- *
- * Since: 3.0
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-gboolean
-gtk_symbolic_color_resolve (GtkSymbolicColor   *color,
-                           GtkStyleProperties *props,
-                           GdkRGBA            *resolved_color)
-{
-  GdkRGBA pink = { 1.0, 0.5, 0.5, 1.0 };
-  GtkCssValue *v, *current;
-
-  g_return_val_if_fail (color != NULL, FALSE);
-  g_return_val_if_fail (resolved_color != NULL, FALSE);
-  g_return_val_if_fail (props == NULL || GTK_IS_STYLE_PROPERTIES (props), FALSE);
-
-  current = _gtk_css_rgba_value_new_from_rgba (&pink);
-  v = _gtk_css_color_value_resolve (color->value,
-                                    GTK_STYLE_PROVIDER_PRIVATE (props),
-                                    current,
-                                    0,
-                                    NULL);
-  _gtk_css_value_unref (current);
-  if (v == NULL)
-    return FALSE;
-
-  *resolved_color = *_gtk_css_rgba_value_get_rgba (v);
-  _gtk_css_value_unref (v);
-  return TRUE;
-}
-
-/**
- * gtk_symbolic_color_to_string:
- * @color: color to convert to a string
- *
- * Converts the given @color to a string representation. This is useful
- * both for debugging and for serialization of strings. The format of
- * the string may change between different versions of GTK, but it is
- * guaranteed that the GTK css parser is able to read the string and
- * create the same symbolic color from it.
- *
- * Returns: a new string representing @color
- *
- * Deprecated: 3.8: #GtkSymbolicColor is deprecated.
- **/
-char *
-gtk_symbolic_color_to_string (GtkSymbolicColor *color)
-{
-  g_return_val_if_fail (color != NULL, NULL);
-
-  return _gtk_css_value_to_string (color->value);
-}
-
-GtkSymbolicColor *
-_gtk_css_symbolic_value_new (GtkCssParser *parser)
-{
-  GtkCssValue *value;
-
-  value = _gtk_css_color_value_parse (parser);
-  if (value == NULL)
-    return NULL;
-
-  return gtk_symbolic_color_new (value);
-}
-
-GtkCssValue *
-_gtk_symbolic_color_get_css_value (GtkSymbolicColor *symbolic)
-{
-  return symbolic->value;
-}
-
diff --git a/gtk/gtksymboliccolor.h b/gtk/gtksymboliccolor.h
deleted file mode 100644 (file)
index 937f935..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2010 Carlos Garnacho <carlosg@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
-#error "Only <gtk/gtk.h> can be included directly."
-#endif
-
-#ifndef __GTK_SYMBOLIC_COLOR_H__
-#define __GTK_SYMBOLIC_COLOR_H__
-
-#include <gdk/gdk.h>
-#include <gtk/gtkstyleproperties.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_SYMBOLIC_COLOR (gtk_symbolic_color_get_type ())
-
-GType              gtk_symbolic_color_get_type    (void) G_GNUC_CONST;
-
-GDK_DEPRECATED_IN_3_8
-GtkSymbolicColor * gtk_symbolic_color_new_literal (const GdkRGBA      *color);
-GDK_DEPRECATED_IN_3_8
-GtkSymbolicColor * gtk_symbolic_color_new_name    (const gchar        *name);
-GDK_DEPRECATED_IN_3_8
-GtkSymbolicColor * gtk_symbolic_color_new_shade   (GtkSymbolicColor   *color,
-                                                   gdouble             factor);
-GDK_DEPRECATED_IN_3_8
-GtkSymbolicColor * gtk_symbolic_color_new_alpha   (GtkSymbolicColor   *color,
-                                                   gdouble             factor);
-GDK_DEPRECATED_IN_3_8
-GtkSymbolicColor * gtk_symbolic_color_new_mix     (GtkSymbolicColor   *color1,
-                                                   GtkSymbolicColor   *color2,
-                                                   gdouble             factor);
-GDK_DEPRECATED_IN_3_8
-GtkSymbolicColor * gtk_symbolic_color_new_win32   (const gchar        *theme_class,
-                                                   gint                id);
-
-GDK_DEPRECATED_IN_3_8
-GtkSymbolicColor * gtk_symbolic_color_ref         (GtkSymbolicColor   *color);
-GDK_DEPRECATED_IN_3_8
-void               gtk_symbolic_color_unref       (GtkSymbolicColor   *color);
-
-GDK_DEPRECATED_IN_3_8
-char *             gtk_symbolic_color_to_string   (GtkSymbolicColor   *color);
-
-GDK_DEPRECATED_IN_3_8
-gboolean           gtk_symbolic_color_resolve     (GtkSymbolicColor   *color,
-                                                   GtkStyleProperties *props,
-                                                   GdkRGBA            *resolved_color);
-
-G_END_DECLS
-
-#endif /* __GTK_SYMBOLIC_COLOR_H__ */
diff --git a/gtk/gtksymboliccolorprivate.h b/gtk/gtksymboliccolorprivate.h
deleted file mode 100644 (file)
index 154c29f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 2011 Benjamin Otte <otte@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __GTK_SYMBOLIC_COLOR_PRIVATE_H__
-#define __GTK_SYMBOLIC_COLOR_PRIVATE_H__
-
-#include "gtk/gtksymboliccolor.h"
-#include "gtk/gtkcssparserprivate.h"
-#include "gtk/gtkcssvalueprivate.h"
-
-G_BEGIN_DECLS
-
-GtkSymbolicColor * _gtk_css_symbolic_value_new            (GtkCssParser               *parser);
-
-GtkCssValue *      _gtk_symbolic_color_get_css_value      (GtkSymbolicColor           *symbolic);
-
-G_END_DECLS
-
-#endif /* __GTK_SYMBOLIC_COLOR_PRIVATE_H__ */